# include <stdio.h>
# include "Range.h"

class ValueInRange {

	private:
		float x;
		Range* range;
	public:
		ValueInRange(){}
		ValueInRange(float xp,Range* rangex){
			this->x=xp;
			range=rangex;
			//setRange(range);
		}
		
	public:
		bool isCorrupted(){
			return range->rangeCheck(x);
		}

		float getX() {
			return x;
		}

		bool setX(float x) {
			if(range==NULL)
				return false;
			if(range->rangeCheck(x)){
				this->x = x;	
				return true;
			}
		return false;
	}

		bool setRange(Range r){
			if(r.rangeCheck(x)){
				if(this->range!=NULL)
					range->lockDown();
				r.lockUp();
				range=&r;
				return true;
			}
			return false;
		}
};



